<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>生成器函数参数实例</title>
</head>
<body>
<script>
  function first() {
    setTimeout(()=>{
      let i='I';
      iterator.next(i)
    },1000);
  }
  function second() {
    setTimeout(()=>{
      let love='Love';
      iterator.next(love)
    },2000);
  }
  function third() {
    setTimeout(()=>{
      let you='You';
      iterator.next(you)
    },3000);
  }
  function * gen() {
    let i= yield first();
    console.log(i)
    let you= yield second();
    console.log(you)
    let love=yield third();
    console.log(love)
  }

  let  iterator=gen();
  iterator.next();

</script>
</body>
</html>